From 1821c2df609b2877d732ad662a399e297ff56a41 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 18 Jan 2016 14:54:25 -0500 Subject: [PATCH] text view: Expose cursor blink control Derived classes like GtkSourceView with their own ::key-event handler need access to this, in order to make their keynav as nice as the builtin one, wrt to caret visibility. https://bugzilla.gnome.org/show_bug.cgi?id=760748 --- docs/reference/gtk/gtk3-sections.txt | 1 + gtk/gtktextview.c | 22 ++++++++++++++++++++++ gtk/gtktextview.h | 3 +++ 3 files changed, 26 insertions(+) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index 51e8bd0158..fe439c97f1 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -3950,6 +3950,7 @@ gtk_text_view_set_editable gtk_text_view_get_editable gtk_text_view_set_cursor_visible gtk_text_view_get_cursor_visible +gtk_text_view_reset_cursor_blink gtk_text_view_set_overwrite gtk_text_view_get_overwrite gtk_text_view_set_pixels_above_lines diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 8bae967a14..659056c3d5 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3538,6 +3538,28 @@ gtk_text_view_get_cursor_visible (GtkTextView *text_view) return text_view->priv->cursor_visible; } +/** + * gtk_text_view_reset_cursor_blink: + * @text_view: a #GtkTextView + * + * Ensures that the cursor is shown (i.e. not in an 'off' blink + * interval) and resets the time that it will stay blinking (or + * visible, in case blinking is disabled). + * + * This function should be called in response to user input + * (e.g. from derived classes that override the textview's + * #GtkWidget::key-press-event handler). + * + * Since: 3.20 + */ +void +gtk_text_view_reset_cursor_blink (GtkTextView *text_view) +{ + g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); + + gtk_text_view_reset_blink_time (text_view); + gtk_text_view_pend_cursor_blink (text_view); +} /** * gtk_text_view_place_cursor_onscreen: diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h index 203fcfba1f..432e7b786c 100644 --- a/gtk/gtktextview.h +++ b/gtk/gtktextview.h @@ -246,6 +246,9 @@ void gtk_text_view_set_cursor_visible (GtkTextView *text_view, GDK_AVAILABLE_IN_ALL gboolean gtk_text_view_get_cursor_visible (GtkTextView *text_view); +GDK_AVAILABLE_IN_3_20 +void gtk_text_view_reset_cursor_blink (GtkTextView *text_view); + GDK_AVAILABLE_IN_ALL void gtk_text_view_get_cursor_locations (GtkTextView *text_view, const GtkTextIter *iter, -- 2.30.2